var t,
  o = require("../../@babel/runtime/helpers/defineProperty"),
  a = require("../../res/www.a9a.cn.js"),
  e = getApp();
Page({
  data: { id: 0 },
  onLoad: function () {
    var o = this;
    e.get_config("_ZEAI").then(function (t) {
      o.setData({
        color: t.color,
        rgbcolor: a.c16_rgb(t.color),
        lovebname: t.loveb,
      });
    }),
      e.chklogin().then(function (a) {
        a
          ? ((t = wx.getStorageSync("COOK_U")),
            e.ajax({
              url: "my_top.php",
              data: { submitok: "init", openid: t.openid },
              success: function (t) {
                1 == t.flag
                  ? 1 != t.ios_ifpay.flag
                    ? wx.getSystemInfo({
                        success: function (a) {
                          "ios" == a.platform
                            ? wx.showModal({
                                title: "温馨提示",
                                content: t.ios_ifpay.tips,
                                confirmColor: o.data.color,
                                cancelText: "返回",
                                confirmText: "联系客服",
                                success: function (t) {
                                  t.confirm
                                    ? wx.redirectTo({
                                        url: "../about/about?t=contact",
                                      })
                                    : t.cancel && wx.navigateBack();
                                },
                              })
                            : o.setData({
                                id: t.id,
                                price: t.price,
                                ARR: t.ARR,
                              });
                        },
                      })
                    : o.setData({ id: t.id, price: t.price, ARR: t.ARR })
                  : "noreg" == t.flag
                  ? wx.navigateTo({ url: "../login/login" })
                  : wx.showModal({
                      content: t.msg,
                      confirmColor: o.data.color,
                      confirmText: "朕知道了",
                      showCancel: !1,
                      success: function (t) {
                        wx.navigateBack();
                      },
                    });
              },
            }))
          : wx.showModal({
              content: "亲~~~请先登录完善资料再来申请哦",
              confirmColor: o.data.color,
              confirmText: "朕知道了",
              showCancel: !1,
              success: function (t) {
                wx.redirectTo({ url: "../login/login" });
              },
            });
      });
  },
  moddataFn: function () {
    wx.navigateTo({ url: "../reg/reg" });
  },
  setidFn: function (t) {
    for (
      var a,
        e = t.currentTarget.dataset.id,
        i = t.currentTarget.dataset.idx,
        n = t.currentTarget.dataset.price,
        c = this.data.ARR,
        r = 0;
      r < c.length;
      r++
    )
      "ed" == c[r].class && this.setData(o({}, "ARR[" + r + "].class", ""));
    this.setData(
      (o((a = {}), "ARR[" + i + "].class", "ed"),
      o(a, "price", n),
      o(a, "id", e),
      a)
    );
  },
  btnFn: function () {
    parseFloat(this.data.price) > 0
      ? e.pay({ data: { submitok: "my_top", objid: this.data.id } })
      : e.ajax({
          url: "my_top.php",
          data: {
            submitok: "ajax_top_free",
            objid: this.data.id,
            openid: t.openid,
          },
          success: function (t) {
            wx.showToast({
              title: t.msg,
              icon: "none",
              mask: !0,
              duration: 2e3,
            }),
              1 == t.flag &&
                setTimeout(function () {
                  wx.reLaunch({ url: "../index/index4" });
                }, 2e3);
          },
        });
  },
});
